package com.itheima.demo02;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

//字节流一次读取一个字节复制
public class ByteClass03 {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        FileInputStream fis = null;
        FileOutputStream fos = null;
        try{
            fis = new FileInputStream("F:\\study\\就业班\\4.jpg");
            fos = new FileOutputStream("F:\\study\\千鸟.jpg");
            int read;
            while ((read = fis.read()) != -1) {
                fos.write(read);
            }
        }catch (IOException e){
            e.getMessage();
        }finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        long end = System.currentTimeMillis();
        System.out.println("程序运行了" + (end - start) + "毫秒！");
    }
}
